package jvm;

import java.lang.ref.SoftReference;

/**
 * @Author Stringzhua
 * @Date 2024/11/6 16:11
 * description:
 */
public class Demo03 {
    public static void main(String[] args) {
        //强引用
        String s1 = new String("test");
        //软引用
        String s2 = new String("test");
        SoftReference<String> softReference = new SoftReference<>(s2);

        //访问软引用
        System.out.println(softReference.get());


    }
}
